<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      let arr = [6, 3, 9, 22, 16, 4, 7, 66]
      let sum = 0
      for(let i = 0;i <= arr.length-1;i++){
        sum += arr[i]
      }
      let = avg = sum / arr.length
      let max = []
      let min = []
      for(let i = 0;i <= arr.length-1;i++){
        if(avg > arr[i]){
          min.push(arr[i])
        } else if(avg < arr[i]){
          max.push(arr[i])
        }
      }
      document.write(`平均值为${avg},<br>比平均值大的为${max},<br>比平均值大的为${min}<br>`)
    </script>
  </body>
</html>
